<?php


namespace App\Models\Base;


use App\Models\BaseModel;

class SizeModel extends BaseModel
{
    public $connection = 'mysql';
    public $table = 'size';

    public $fillable = [
        'type',
        'name',
        'create_user',
        'create_user_uuid',
    ];

    /**
     * 添加
     * @param $data
     * @return array
     */
    public function addSize($data)
    {
        $insert['type'] = $data['type'];
        $insert['create_user'] = config('userInfo')['member_name'];
        $insert['create_user_uuid'] = config('userInfo')['uuid'];

        $names = explode(',', $data['name']);
        foreach ($names as $k => $v) {
            $insert['name'] = $v;
            $this->create($insert);
        }

        return [];
    }
}
